package com.example.cpsc.sc.Controller;

import com.example.cpsc.sc.Do.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Api(value = "测试API类")
public class SwaggerController {
    /*@GetMapping(value = "/hello")
    public String hello(){
        return "hello";
    }*/

    //只要我么的接口中，返回值中存在实体类，它就会被扫描
    @PostMapping(value = "/user")
    public User user(){
        return new User();
    }

    @ApiOperation("控制类")
    @GetMapping(value = "/getuser")
    public String cp(@ApiParam("用户名") String username){
        return "hello"+username;
    }

    @ApiOperation("post测试类")
    @PostMapping(value = "/post")
    public User post(@ApiParam("用户名") User user){
        return new User();
    }
}
